package com.powernode.teatraceability.utils;


import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@Builder
public class JsonData<T>{
    private int status;
    private String msg;
    private T data;

    public JsonData(int status, String msg, T data) {
        this.status = status;
        this.msg = msg;
        this.data = data;
    }

    public static <T> JsonData<T> success() {
        return new JsonData<T>(200, "true", null);
    }
    public static <T> JsonData<T> success(T data) {
        return new JsonData<T>(200, "true", data);
    }
    public static <T> JsonData<T> success(T data, String msg) {
        return new JsonData<T>(200, msg, data);
    }
    public static <T> JsonData<T> failure(int status, T data) {
        return new JsonData<>(status, "false", data);
    }
    public static <T> JsonData<T> failure(int status, T data, String msg) {
        return new JsonData<>(status, msg, data);
    }

}
